<%-- 
    Document   : header
    Created on : Jan 28, 2012, 2:47:19 PM
    Author     : Yogi
--%>

<%@page import="edu.uta.tsrh.model.User"%>


<script type="text/javascript">
    
    function showForm(){
        document.getElementById("#login_prompt").style.visibility = 'hidden';
        document.getElementById("#login_form").style.visibility = 'visible';
        document.getElementById("#login_error").style.visibility = 'hidden';
    }
    
    $(document).ready(function(){
        
        $("#login_link").click(function(e){
            $("#login_prompt").hide(125);
            $("#login_form").show(125);
            $("#login_error").hide(125);
            
            e.preventDefault();
        });
        
        $("#login_cancel_link").click(function(e){
            $("#login_form").hide(125);
            $("#login_prompt").show(125);
            $("#login_error").hide(125)
            
            e.preventDefault();
        });
    });

    
</script>

<header>    
    <div id="user_status">
        <%

            String user = (String) session.getAttribute("user");
            if (user != null && user != "") {
        %>
        Welcome <%= session.getAttribute("user")%>! <a href="/TSRH/logout.jsp">Logout</a> 

        <% } else {%>

        <span id="login_prompt">Welcome Guest! <a id="login_link" href="">Login</a></span>

        <span id="login_form" style="display:none">
            <form action="/TSRH/login.jsp" method="post">
                <label for="login_username">Username:</label>
                <input type="text" name="login_username" id="login_username" />

                <br />

                <label for="login_password">Password:</label>
                <input type="password" name="login_password" id="login_password" />

                <br />

                <input type="submit" id="login_submit_link" value="Login" />

                <input type="reset" id="login_cancel_link" value="Cancel" />
            </form>
        </span>

        <%
            String fail = (String) session.getAttribute("login_error");
            if (fail != null && fail != "") {

                session.removeAttribute("login_error");
        %>
        <br /><br /><span id="login_error" class="error">Bad login!</span> 
        <% }%>

        <% }%>
    </div> 

    <div class="container">
        <h1><a href="index.jsp">Hope Center</a></h1>
        <nav>
            <ul>
                <li class="current"><a href="index.jsp"><strong>Home</strong></a></li>
                <li><a href="test.jsp"><strong>Test</strong></a></li>
                <li><a href="consult.jsp"><strong>Consult</strong></a></li>
                <li><a href="FileTracking">File Tracking</a></li>
                <li><a href="notification.jsp"><strong>Set Alert</strong></a></li>
                <li><a href=PatientSearch><strong>Patient Search</strong></a></li>
                <li><a href=userCreation.jsp><strong>Create User</strong></a></li>
                <li><a href=reportGeneration.jsp><strong>Reports</strong></a></li>
            </ul>
        </nav>
        <div id="slogan"></div>
    </div>

</header>